package com.yeyouluo.partition;

import org.apache.hadoop.io.Writable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public class PartitionBean implements Writable {
    private String logId;
    private String deviceId;
    private String appKey;
    private String ipAddr;
    private Long selfDuration;
    private Long thirdPartDuration;
    private Long statusCode;

    public PartitionBean() {
    }

    public PartitionBean(String logId, String deviceId, String appKey, String ipAddr, Long selfDuration, Long thirdPartDuration, Long statusCode) {
        this.logId = logId;
        this.deviceId = deviceId;
        this.appKey = appKey;
        this.ipAddr = ipAddr;
        this.selfDuration = selfDuration;
        this.thirdPartDuration = thirdPartDuration;
        this.statusCode = statusCode;
    }

    @Override
    public void write(DataOutput out) throws IOException {
        out.writeUTF(logId);
        out.writeUTF(deviceId);
        out.writeUTF(appKey);
        out.writeUTF(ipAddr);
        out.writeLong(selfDuration);
        out.writeLong(thirdPartDuration);
        out.writeLong(statusCode);
    }

    @Override
    public void readFields(DataInput in) throws IOException {
        this.logId = in.readUTF();
        this.deviceId = in.readUTF();
        this.appKey = in.readUTF();
        this.ipAddr = in.readUTF();
        this.selfDuration = in.readLong();
        this.thirdPartDuration = in.readLong();
        this.statusCode = in.readLong();
    }

    @Override
    public String toString() {
        return logId +
                "\t" + deviceId +
                "\t" + appKey +
                "\t" + ipAddr +
                "\t" + selfDuration +
                "\t" + thirdPartDuration +
                "\t" + statusCode;
    }

    public String getLogId() {
        return logId;
    }

    public void setLogId(String logId) {
        this.logId = logId;
    }

    public String getDeviceId() {
        return deviceId;
    }

    public void setDeviceId(String deviceId) {
        this.deviceId = deviceId;
    }

    public String getAppKey() {
        return appKey;
    }

    public void setAppKey(String appKey) {
        this.appKey = appKey;
    }

    public String getIpAddr() {
        return ipAddr;
    }

    public void setIpAddr(String ipAddr) {
        this.ipAddr = ipAddr;
    }

    public Long getSelfDuration() {
        return selfDuration;
    }

    public void setSelfDuration(Long selfDuration) {
        this.selfDuration = selfDuration;
    }

    public Long getThirdPartDuration() {
        return thirdPartDuration;
    }

    public void setThirdPartDuration(Long thirdPartDuration) {
        this.thirdPartDuration = thirdPartDuration;
    }

    public Long getStatusCode() {
        return statusCode;
    }

    public void setStatusCode(Long statusCode) {
        this.statusCode = statusCode;
    }
}
